package com.qifenqian.turbot.config

import android.app.Application
import android.content.Context
import android.support.multidex.MultiDex
import com.bumptech.glide.request.target.ViewTarget
import com.qifenqian.turbot.R
import com.qifenqian.turbot.util.SpUtils

/**
 * @author H
 * @createTime 2018/12/13 13:40
 * @description
 * @see
 * @since
 */
class TurbotApplication : Application() {

    companion object {
        private var instance: Application? = null
        fun instance(): Context = instance!!

    }

    override fun onCreate() {
        super.onCreate()
        instance = this
        SpUtils.getInstance().init(this)
        ViewTarget.setTagId(R.id.glide_tag) //为了可以给图片设置tag
//        initAppStatusListener()
    }

    private fun initAppStatusListener() {
        ForegroundCallbacks.init(this).addListener(object :ForegroundCallbacks.Listener{
            override fun onBecameForeground() {

            }

            override fun onBecameBackground() {
            }
        })
    }

    override fun attachBaseContext(base: Context?) {
        super.attachBaseContext(base)
        MultiDex.install(this)
    }
}